﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using XiaoMi8.Models;
using XiaoMi8.ViewModels;

namespace XiaoMi8.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class HomePage : ContentPage
    {
        public HomePage()
        {
            InitializeComponent();
            ListViewViewModel listViewViewModel = new ListViewViewModel();
            this.BindingContext = listViewViewModel;
        }

        private void CollectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListViewModel listViewModel = this.CollectionView.SelectedItem as ListViewModel;
            Console.WriteLine(listViewModel.Title);
            Navigation.PushModalAsync(new DetailPage()
            {
                BindingContext = listViewModel
            });
        }
    }
}